<?php

function query( $_qry ) {

  global $database;
  $result = $database->query( $_qry );

  return $result;

}

function getVar( $_var, $_method ) {

  switch( $_method ) {
    case 'POST':
      $var = $_POST[ $_var ];
      break;
    case 'GET':
      $var = $_GET[ $_var ];
      break;
    case 'COOKIE':
      $var = $_COOKIE[ $_var ];
      break;
    case 'SESSION':
      $var = $_SESSION[ $_var ];
      break;
    case 'SERVER':
      $var = $_SERVER[ $_var ];
      break;
    default:
      break;
  }

  return $var;

}

function checkadmin() {

  global $user;
  if( $user->admin ) {
    return true;
  } else {
    return false;
  }

}

?>